package dataStruct;

import java.awt.Dimension;

import javax.swing.JFrame;

public class DisplayCity extends javax.swing.JFrame {

	
	public static void main(String[] args) {
		City[] vertices = {
				new City(50, 80, "SZ"),
				new City(200, 130, "GZ"),
				new City(350, 420, "ShangHai"),
				new City(400, 500, "BeiJing")
		};
		
		int[][] edges = {
				{0, 1}, {0, 2}, {0, 3},
				{1, 2}, {1, 3},
				{2, 1},
				{3, 2}
		};
		
		Graph<City> graph = new UnweightedGraph<City>(edges, vertices);
		JFrame frame = new DisplayCity();
		frame.add(new GraphView(graph));
		frame.setSize(new Dimension(600, 600));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);

	}
	

	static class City implements Displayable
	{
		private int x, y;
		private String name;
		
		public City(int x, int y, String name)
		{
			this.x = x;
			this.y = y;
			this.name = name;
		}
		
		public int getX()
		{
			return x;
		}
		
		public int getY()
		{
			return y;
		}
		
		public String getName()
		{
			return name;
		}
	}

}
